package com.greet.mapper;

import com.greet.annotation.AutoFill;
import com.greet.dto.DishPageQueryDTO;
import com.greet.entity.Dish;
import com.greet.enumeration.OperationType;
import com.greet.vo.DishVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DishMapper {
    public List<Dish> select(Dish dish);

    List<DishVO> selectPageQuery(DishPageQueryDTO dishPageQueryDTO);

    @Select("select count(0) from dish")
    long countAll();

    @AutoFill(OperationType.INSERT)
    void insert(Dish dish);

    @Select("select id, name, category_id, price, image, description, status, create_time, update_time, create_user, update_user " +
            "from dish where name=#{name}")
    Dish selectByName(String name);

    @AutoFill(OperationType.UPDATE)
    void update(Dish dish);

    void deletByIds(List<Long> ids);

    Integer countByStatus(Integer status);
}
